package com.itheima.utils;

import java.util.List;

import lombok.Data;

/**
 * @author ：yuan_he_song
 */
@Data
public class PageEntity<T> {

    /**
     * 每页记录大小
     */
    private Integer pageSize;
    /**
     * 总记录数
     */
    private Integer total;
    /**
     * 总页数
     */
    private Integer pages;

    /**
     * 每页数据集
     */
    private List<T> list;

    public PageEntity(Integer pageSize, Integer total, List list){
        this.list = list;
        this.total = total;
        this.pageSize = pageSize;
        /** 总页数 */
        if (total % pageSize == 0){
            this.pages = total/pageSize;
        } else {
            this.pages = total/pageSize + 1;
        }
    }

}
